class CreateGroupSchedules < ActiveRecord::Migration
  def self.up
    create_table :group_schedules do |t|
      t.references :group
      t.references :schedule

      t.timestamps
    end
    add_index(:group_schedules, [:group_id, :schedule_id], :unique => true)
    add_index(:group_schedules, :group_id, :unique => false)
  end

  def self.down
    remove_index(:group_schedules, [:group_id, :schedule_id])
    remove_index(:group_schedules, :group_id)
    drop_table :group_schedules
  end
end
